package Decorator.decoratorInterfaceImpl;

import Decorator.component.Beverage;
import Decorator.decoratorInterface.CondimentDecorator;

/**
 * 具体装饰者,Mocha是一个具体装饰者，所以会继承CondimentDecorator类；
 *
 * 要让Mocha引用一个Beverage，如下做法
 * 1.用一个实例变量记录被装饰者
 * 2.想办法让被装饰者记录到实例变量当中
 * @Author: pengzx
 * @Description:
 * @Date: 17:03 2017/9/6
 * @Modified by: 1.0
 */
public class Mocha extends CondimentDecorator {
    Beverage beverage;
    @Override
    public String getDescribe()
    {
        return beverage.getDescribe()+",Mocha";
    }

    @Override
    public double cost()
    {
        return .2+beverage.cost();
    }

    public Mocha(Beverage beverage)
    {
        this.beverage = beverage;
    }

}
